#[derive(Clone, Copy)]
pub struct Access(pub u16);
#[rustfmt::skip]
impl Access {
	const PUBLIC: u16       = 0x0001; // class field method
	const PRIVATE: u16      = 0x0002; //       field method
	const PROTECTED: u16    = 0x0004; //       field method
	const STATIC: u16       = 0x0008; //       field method
	const FINAL: u16        = 0x0010; // class field method
	const SUPER: u16        = 0x0020; // class
	const SYNCHRONIZED: u16 = 0x0020; //             method
	const VOLATILE: u16     = 0x0040; //       field
	const BRIDGE: u16       = 0x0040; //             method
	const TRANSIENT: u16    = 0x0080; //       field
	const VARARGS: u16      = 0x0080; //             method
	const NATIVE: u16       = 0x0100; //             method
	const INTERFACE: u16    = 0x0200; // class
	const ABSTRACT: u16     = 0x0400; // class       method
	const STRICT: u16       = 0x0800; //             method
	const SYNTHETIC: u16    = 0x1000; // class field method
	const ANNOTATION: u16   = 0x2000; // class
	const ENUM: u16         = 0x4000; // class field
}
impl Access {
	pub fn is_public(&self) -> bool {
		self.0 & Self::PUBLIC != 0
	}
	pub fn is_private(&self) -> bool {
		self.0 & Self::PRIVATE != 0
	}
	pub fn is_protected(&self) -> bool {
		self.0 & Self::PROTECTED != 0
	}
	pub fn is_static(&self) -> bool {
		self.0 & Self::STATIC != 0
	}
	pub fn is_final(&self) -> bool {
		self.0 & Self::FINAL != 0
	}
	pub fn is_super(&self) -> bool {
		self.0 & Self::SUPER != 0
	}
	pub fn is_synchronized(&self) -> bool {
		self.0 & Self::SYNCHRONIZED != 0
	}
	pub fn is_volatile(&self) -> bool {
		self.0 & Self::VOLATILE != 0
	}
	pub fn is_bridge(&self) -> bool {
		self.0 & Self::BRIDGE != 0
	}
	pub fn is_transient(&self) -> bool {
		self.0 & Self::TRANSIENT != 0
	}
	pub fn is_varargs(&self) -> bool {
		self.0 & Self::VARARGS != 0
	}
	pub fn is_native(&self) -> bool {
		self.0 & Self::NATIVE != 0
	}
	pub fn is_interface(&self) -> bool {
		self.0 & Self::INTERFACE != 0
	}
	pub fn is_abstract(&self) -> bool {
		self.0 & Self::ABSTRACT != 0
	}
	pub fn is_strict(&self) -> bool {
		self.0 & Self::STRICT != 0
	}
	pub fn is_synthetic(&self) -> bool {
		self.0 & Self::SYNTHETIC != 0
	}
	pub fn is_annotation(&self) -> bool {
		self.0 & Self::ANNOTATION != 0
	}
	pub fn is_enum(&self) -> bool {
		self.0 & Self::ENUM != 0
	}
}
impl std::fmt::Debug for Access {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		let mut f = f.debug_tuple("Access");
		if self.is_public() {
			f.field(&"publib");
		}
		if self.is_private() {
			f.field(&"private");
		}
		if self.is_protected() {
			f.field(&"protected");
		}
		if self.is_static() {
			f.field(&"static");
		}
		if self.is_final() {
			f.field(&"final");
		}
		if self.is_super() {
			f.field(&"super");
		}
		if self.is_synchronized() {
			f.field(&"synchronized");
		}
		if self.is_volatile() {
			f.field(&"volatile");
		}
		if self.is_bridge() {
			f.field(&"bridge");
		}
		if self.is_transient() {
			f.field(&"transient");
		}
		if self.is_varargs() {
			f.field(&"varargs");
		}
		if self.is_native() {
			f.field(&"native");
		}
		if self.is_interface() {
			f.field(&"interface");
		}
		if self.is_abstract() {
			f.field(&"abstract");
		}
		if self.is_strict() {
			f.field(&"strict");
		}
		if self.is_synthetic() {
			f.field(&"synthetic");
		}
		if self.is_annotation() {
			f.field(&"annotation");
		}
		if self.is_enum() {
			f.field(&"enum");
		}
		f.finish()
		// f.write_fmt(format_args!("{}", self.0))
	}
}
impl std::fmt::Display for Access {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		if self.is_public() {
			f.write_str("publib ")?;
		}
		if self.is_private() {
			f.write_str("private ")?;
		}
		if self.is_protected() {
			f.write_str("protected ")?;
		}
		if self.is_static() {
			f.write_str("static ")?;
		}
		if self.is_final() {
			f.write_str("final ")?;
		}
		if self.is_super() {
			f.write_str("super ")?;
		}
		if self.is_synchronized() {
			f.write_str("synchronized ")?;
		}
		if self.is_volatile() {
			f.write_str("volatile ")?;
		}
		if self.is_bridge() {
			f.write_str("bridge ")?;
		}
		if self.is_transient() {
			f.write_str("transient ")?;
		}
		if self.is_varargs() {
			f.write_str("varargs ")?;
		}
		if self.is_native() {
			f.write_str("native ")?;
		}
		if self.is_interface() {
			f.write_str("interface ")?;
		}
		if self.is_abstract() {
			f.write_str("abstract ")?;
		}
		if self.is_strict() {
			f.write_str("strict ")?;
		}
		if self.is_synthetic() {
			f.write_str("synthetic ")?;
		}
		if self.is_annotation() {
			f.write_str("annotation ")?;
		}
		if self.is_enum() {
			f.write_str("enum ")?;
		}
		Ok(())
	}
}
